FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["DanaZhangCms/DanaZhangCms.csproj", "DanaZhangCms/"]
COPY ["DanaZhangCms.IRepositories/DanaZhangCms.IRepositories.csproj", "DanaZhangCms.IRepositories/"]
COPY ["DanaZhangCms.Models/DanaZhangCms.Models.csproj", "DanaZhangCms.Models/"]
COPY ["DanaZhangCms.Core/DanaZhangCms.Core.csproj", "DanaZhangCms.Core/"]
COPY ["DanaZhangCms.ViewModels/DanaZhangCms.ViewModels.csproj", "DanaZhangCms.ViewModels/"]
COPY ["DanaZhangCms.Controllers/DanaZhangCms.Controllers.csproj", "DanaZhangCms.Controllers/"]
COPY ["DanaZhangCms.Repositories/DanaZhangCms.Repositories.csproj", "DanaZhangCms.Repositories/"]
RUN dotnet restore "DanaZhangCms/DanaZhangCms.csproj"
COPY . .
WORKDIR "/src/DanaZhangCms"
RUN dotnet build "DanaZhangCms.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "DanaZhangCms.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "DanaZhangCms.dll"]